@extends("ogreencard/layout/layout")
@section('h1',"订单管理")
@section("h2","物流派送")
@section("content")
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form">
                {{csrf_field()}}
                <input type="hidden" name="order_id" value="{{$order->order_id}}">

                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">快递日期</label>
                    <div class="layui-input-inline">
                        <input value="{{$order->express_date}}" id="express_date" name="express_date" required="" lay-verify="express_date" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="" class="layui-form-label">快递用户</label>
                    <div class="layui-input-inline">
                        <input value="{{$order->express_user}}"  name="express_user" layui-v autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="" class="layui-form-label">快递电话</label>
                    <div class="layui-input-inline">
                        <input value="{{$order->express_mobile}}"  name="express_mobile"  autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="" class="layui-form-label">快递地址</label>
                    <div class="layui-input-inline">
                        <input value="{{$order->express_address}}"  name="express_address"  autocomplete="off" class="layui-input">
                    </div>
                </div>



                <div class="layui-form-item">
                    <label for="" class="layui-form-label">快递单号</label>
                    <div class="layui-input-inline">
                        <input value="{{$order->express_code}}"  name="express_code"  autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="" class="layui-form-label"></label>
                    <button class="layui-btn" lay-filter="add" lay-submit="">确定</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        var table = '';
        layui.use(['table','form', 'layer','laydate'], function ()
        {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            table = layui.table;

            layui.laydate.render({
                "elem":"#express_date",
                type: 'datetime'
            })

            //监听提交
            form.on('submit(add)', function (data) {

                console.log(data.field);

                //发异步，把数据提交给php
                layui.jquery.post({
                    url:"./orderExpress",
                    data:data.field,
                    success:function(res){
                        if(res.code != 200){
                            layer.alert(res.msg,{icon:7});
                        }else{
                            layer.alert("操作成功", {icon: 6}, function ()
                            {
                                // 获得frame索引
                                //var index = parent.layer.getFrameIndex(window.name);
                                parent.window.location.reload();
                                //关闭当前frame
                                //parent.layer.close(index);
                            });
                        }
                        return false;
                    }
                })
                return false;
            });

        });
    </script>

@endsection